package lemon.dog.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lemon.dog.common.R;
import lemon.dog.domain.User;
import lemon.dog.service.UserService;
import lemon.dog.vo.LoginVo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags = "用户接口")
@RestController
@RequestMapping("user")
public class UserController {
    @Resource
    private UserService userService;

    @ApiOperation("登录")
    @PostMapping("login")
    public R login(LoginVo user) {
        return userService.login(user);
    }

    @ApiOperation("注册")
    @PostMapping("register")
    public R register(@RequestBody LoginVo user) {
        return userService.register(user);
    }

}
